Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Get the inner db of an
(abstract-)level(up|down)
onion.
Useful for modules likesubleveldown
to peel off redundant layers.
const reachdown = require('reachdown')
const db = require('level')('example')
Get the innermost db
, which in this case is a leveldown
instance in node or level-js
in browsers:
const down = reachdown(db)
Get a specific layer by type:
const enc = reachdown(db, 'encoding-down')
const down = reachdown(enc)
const levelup = reachdown(db, 'levelup') // levelup === db
Use a visitor function:
const down = reachdown(db, function (db, type) {
return db.someProperty && type !== 'levelup'
})
db = reachdown(db[, visit][, strict = false])
The db
argument is required and must be a recent-ish levelup
, abstract-leveldown
or subleveldown
instance. The visit
argument can be:
db
with a matching typedb
for which visit
returns a truthy valuedb
.If visit
is non-falsy and no matching db
is found, reachdown
returns null
unless strict
is false
in which case it returns the innermost db
.
bool = reachdown.is(db, visit)
Utility to determine the type of db
without reaching down. The visit
argument is the same as above, i.e. a string or a function. Example:
if (reachdown.is(db, 'levelup')) {
// ..
}
Which is the same as the following, except that reachdown.is(..)
also works on older versions that don't have a type
property:
if (db.type === 'levelup') {
// ..
}
levelup
(>= 0.0.2 only if db is open, otherwise >= 2.0.0)encoding-down
(>= 1)deferred-leveldown
(>= 0.3.0 only if db is open, otherwise >= 2.0.0)subleveldown
(>= 4)multileveldown
(TBD)Implementations of abstract-leveldown
can declare a type like so:
MyLeveldown.prototype.type = 'my-leveldown'
So that consumers can find that layer:
var down = MyLeveldown()
var db = levelup(down)
reachdown(db, 'my-leveldown') === down
With npm do:
npm install reachdown
MIT © 2019-present Vincent Weevers
FAQs
Get the inner db of an (abstract-)level(up|down) onion
The npm package reachdown receives a total of 66,446 weekly downloads. As such, reachdown popularity was classified as popular.
We found that reachdown demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.